package handler;

import android.media.MediaMetadataRetriever;

/**
 * API allowing to get the Metadata from mp3 file
 * @author jean
 *
 */
public class APIMediaTag {
	
	private MediaMetadataRetriever mmr;
	
	public APIMediaTag(String s) {
		mmr = new MediaMetadataRetriever();
		mmr.setDataSource(s);
	}
	
	public String getTitle() {
		return mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
	}
	
	public String getArtist() {
		return mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
	}
	
	public String getAlbum() {
		return mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
	}
	
	public String getGenre() {
		return mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE);
	}
	
	public String getTrackNumber() {
		return mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER);
	}
	
	public byte[] getImage() {
		return mmr.getEmbeddedPicture();
	}
}
